package com.jfinal_demo.app.services;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal_demo.app.model.Tag;

import java.util.List;

public class TagService extends BaseService {
    public Tag createTag(String tagName) {
        Tag tag = new Tag();
        tag.setName(tagName);
        tag.save();
        return tag;
    }

    public List<Tag> list() {
        return Tag.dao.find(Db.getSqlPara("tag.list"));
    }

    public boolean deleteTag(long tagId) {
        return Tag.dao.deleteById(tagId);
    }
}
